package com.chen.business.system.businesssystem.service;

import com.chen.order.system.ordersystem.entity.OrderEntity;
import com.chen.pay.system.paysystem.entity.PayEntity;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 业务逻辑处理
 * @author :master
 */
@Service
public class BusinessServiceImpl {

    @Autowired
    private OrderFeignServiceImpl orderFeignService;

    @Autowired
    private PayFeignServiceImpl payService;


    /**
     * 生成订单
     * @param entity 参数
     */
    public void placeOrder(OrderEntity entity) {
        orderFeignService.addOrder(entity);
        PayEntity payEntity = new PayEntity();
        payEntity.setPayCount(entity.getOrderCount());
        payEntity.setPayMoney(entity.getOrderMoney());
        payEntity.setPayOrder(entity.getOrderCount());
        payEntity.setPayTime(entity.getOrderTime());
        payEntity.setPayName(entity.getOrderName());
        payEntity.setPayStatus("0");
        payService.addPay(payEntity);
    }
}
